/*
 * @Description: 构造函数模式+原型模式
 * @Author: rendc
 * @Date: 2022-10-10 11:45:18
 * @LastEditors: rendc
 * @LastEditTime: 2022-10-10 11:47:00
 */
function Person (name, age, gender) {
  this.name = name;
  this.age = age;
  this.gender = gender;
  Person.prototype.sayName = function () {
    console.log(this.name);
  };
}
var p1 = new Person("tom", 12, 1);
var p2 = new Person("larry", 22, 2);
p1.sayName()
p2.sayName()
console.log(p1.sayName == p2.sayName); //true